/*
 * @Description:分页模型
 * @Version: 2.0
 * @Autor: kafei
 * @Date: 2021-11-30 15:03:26
 * @LastEditors: kafei
 * @LastEditTime: 2021-12-01 14:44:36
 */
class PageModel {
  constructor(page, size, data) {
    this.page = Number(page) || 1
    this.size = Number(size) || 10
    this.total = data.length || 0
    this.result = []
    this.setResult(data)
  }
  setResult(data) {
    const start = (this.page - 1) * this.size // page size
    const end = this.page * this.size
    this.result = data.slice(start, end)
  }
}
module.exports = {
  PageModel
}
